'use strict';

function median_to_letter(collection) {
  //排序，中位数是要排序的！！！！
  collection = collection.sort((a,b)=>(a-b)) ;
  let L = collection.length ;
  let centerNum ;
  if(L %2 ===0){
    centerNum = Math.ceil((collection[L/2] +collection[L/2-1])/2) ;
  }else{
    centerNum = Math.ceil(collection[(L+1)/2]) ;
  }
  
  return num_turn_letter(centerNum) ;
}

module.exports = median_to_letter;
function num_turn_letter(num){ 
  let str = '' ;
  if(num <= 26){
    if(num === 0){
      num += 26 ;
    }
     str = String.fromCharCode(num+96) ;
     return str ;
  }else{
    str = String.fromCharCode(Math.floor(num/26) +96) ;
    return str + num_turn_letter(num%26) ;
  }
}
// var collection = [20,21,22,23,24,25,26,27,28,29,
//   30,31,32,33,34,35,36,37,38,39,
//   40,41,42,43,44,45,46,47,48,49,
//   50,51,52,53];
//   console.log(median_to_letter(collection)) ;